package com.googlecode.androidkurskoblenz.jledcube;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Toolkit;

import javax.media.j3d.BranchGroup;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;
import javax.media.j3d.VirtualUniverse;
import javax.vecmath.Vector3f;

import com.sun.j3d.utils.universe.SimpleUniverse;

public class SimpleLedCube extends LedCube
{
	private SimpleUniverse universe;
	
	@Override
	protected void addBranchGroup(BranchGroup bg)
	{
		universe.addBranchGraph(bg);
		
		TransformGroup vpTG = this.universe.getViewingPlatform().getViewPlatformTransform();
		Transform3D Trfcamera = new Transform3D();
		Trfcamera.setTranslation(new Vector3f(0.0f, 2.0f, LedCube.CAMERA_Z));
		vpTG.setTransform(Trfcamera);
	}
	
	@Override
	protected VirtualUniverse createUniverse()
	{
		Dimension universeSize = Toolkit.getDefaultToolkit().getScreenSize();
		
		universe = new SimpleUniverse();
		
		// Maximize
		universe.getCanvas().setSize(universeSize);
		universe.getViewingPlatform().setNominalViewingTransform();
		
		return universe;
	}
	
	@Override
	protected Component getCanvas()
	{
		return universe.getCanvas();
	}

        public static void main(String args[]) {
            SimpleLedCube slc = new SimpleLedCube();
        }
}
